package Ex615;

/**
 * @Description: 狗类
 */
public class Dog extends Animal {

    public Dog() {
    }

    public Dog(String _name) {
        this.name = _name;
    }

    public void bark() {
        System.out.println(this.name + " wang~~~");
    }

    public void bite(Animal a, int hurt) {
        System.out.println(this.name + " bite " + a.name);
        if (a.blood > hurt && hurt < 10) {//如果伤害值小于10
            a.blood -= 5;
            System.out.println(a.name + " blood is " + a.blood);
        } else if (a.blood > hurt && hurt >= 10) {//如果伤害值大于10
            a.blood -= hurt;//减血
            System.out.println(a.name + " blood is  " + a.blood);
        } else {//当血量为0
            a.blood = 0;
            System.out.println(a.name + " is dead");
        }
    }
}